<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            width: 1366px;
            height: 700px;
        }
        img{
            position: absolute;
            display: block;
            width: 100px;
            height: 80px;
        }
    </style>
</head>
<body>
    <img src="../images/3.jpg" alt="">

    <script>
        document.body.onmousemove=function(e){
            e = e|| window.event;
            //找到图像
            var img=document.querySelector('img')
            //设置坐标
            img.style.left=e.pageX+'px';
            img.style.top=e.pageY+'px';
        }
        // for(var i=0;i<100;i++){
        //     var result=getPosi();
        // }
        // function getPosi(){
        //     var x=Math.round(Math.random()*100)+1;
        //     var y=Math.round(Math.random()*100)+1;
        //     return (x:x,y:y);
        // }
    </script>
</body>
</html>